<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>LCOV - mbi.info - /usr/include/c++/4.4.1/sstream</title>
  <link rel="stylesheet" type="text/css" href="../../../../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LTP GCOV extension - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
        <tr>
          <td class="headerItem" width="20%">Current&nbsp;view:</td>
          <td class="headerValue" width="80%" colspan=4><a href="../../../../index.html">directory</a> - <a href="index.html">usr/include/c++/4.4.1</a> - sstream</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Test:</td>
          <td class="headerValue" width="80%" colspan=4>mbi.info</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Date:</td>
          <td class="headerValue" width="20%">2010-01-23</td>
          <td width="20%"></td>
          <td class="headerItem" width="20%">Instrumented&nbsp;lines:</td>
          <td class="headerValue" width="20%">36</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Code&nbsp;covered:</td>
          <td class="headerValue" width="20%">0.0 %</td>
          <td width="20%"></td>
          <td class="headerItem" width="20%">Executed&nbsp;lines:</td>
          <td class="headerValue" width="20%">0</td>
        </tr>
        </table>
      </td>
    </tr>
    <tr><td class="ruler"><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td><pre class="source">
<span class="lineNum">       1 </span>                : // String based streams -*- C++ -*-
<span class="lineNum">       2 </span>                : 
<span class="lineNum">       3 </span>                : // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
<span class="lineNum">       4 </span>                : // 2006, 2008, 2009 Free Software Foundation, Inc.
<span class="lineNum">       5 </span>                : //
<span class="lineNum">       6 </span>                : // This file is part of the GNU ISO C++ Library.  This library is free
<span class="lineNum">       7 </span>                : // software; you can redistribute it and/or modify it under the
<span class="lineNum">       8 </span>                : // terms of the GNU General Public License as published by the
<span class="lineNum">       9 </span>                : // Free Software Foundation; either version 3, or (at your option)
<span class="lineNum">      10 </span>                : // any later version.
<span class="lineNum">      11 </span>                : 
<span class="lineNum">      12 </span>                : // This library is distributed in the hope that it will be useful,
<span class="lineNum">      13 </span>                : // but WITHOUT ANY WARRANTY; without even the implied warranty of
<span class="lineNum">      14 </span>                : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
<span class="lineNum">      15 </span>                : // GNU General Public License for more details.
<span class="lineNum">      16 </span>                : 
<span class="lineNum">      17 </span>                : // Under Section 7 of GPL version 3, you are granted additional
<span class="lineNum">      18 </span>                : // permissions described in the GCC Runtime Library Exception, version
<span class="lineNum">      19 </span>                : // 3.1, as published by the Free Software Foundation.
<span class="lineNum">      20 </span>                : 
<span class="lineNum">      21 </span>                : // You should have received a copy of the GNU General Public License and
<span class="lineNum">      22 </span>                : // a copy of the GCC Runtime Library Exception along with this program;
<span class="lineNum">      23 </span>                : // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
<span class="lineNum">      24 </span>                : // &lt;http://www.gnu.org/licenses/&gt;.
<span class="lineNum">      25 </span>                : 
<span class="lineNum">      26 </span>                : /** @file sstream
<span class="lineNum">      27 </span>                :  *  This is a Standard C++ Library header.
<span class="lineNum">      28 </span>                :  */
<span class="lineNum">      29 </span>                : 
<span class="lineNum">      30 </span>                : //
<span class="lineNum">      31 </span>                : // ISO C++ 14882: 27.7  String-based streams
<span class="lineNum">      32 </span>                : //
<span class="lineNum">      33 </span>                : 
<span class="lineNum">      34 </span>                : #ifndef _GLIBCXX_SSTREAM
<span class="lineNum">      35 </span>                : #define _GLIBCXX_SSTREAM 1
<span class="lineNum">      36 </span>                : 
<span class="lineNum">      37 </span>                : #pragma GCC system_header
<span class="lineNum">      38 </span>                : 
<span class="lineNum">      39 </span>                : #include &lt;istream&gt;
<span class="lineNum">      40 </span>                : #include &lt;ostream&gt;
<span class="lineNum">      41 </span>                : 
<span class="lineNum">      42 </span>                : _GLIBCXX_BEGIN_NAMESPACE(std)
<span class="lineNum">      43 </span>                : 
<span class="lineNum">      44 </span>                :   // [27.7.1] template class basic_stringbuf
<span class="lineNum">      45 </span>                :   /**
<span class="lineNum">      46 </span>                :    *  @brief  The actual work of input and output (for std::string).
<span class="lineNum">      47 </span>                :    *  @ingroup io
<span class="lineNum">      48 </span>                :    *
<span class="lineNum">      49 </span>                :    *  This class associates either or both of its input and output sequences
<span class="lineNum">      50 </span>                :    *  with a sequence of characters, which can be initialized from, or made
<span class="lineNum">      51 </span>                :    *  available as, a @c std::basic_string.  (Paraphrased from [27.7.1]/1.)
<span class="lineNum">      52 </span>                :    *
<span class="lineNum">      53 </span>                :    *  For this class, open modes (of type @c ios_base::openmode) have
<span class="lineNum">      54 </span>                :    *  @c in set if the input sequence can be read, and @c out set if the
<span class="lineNum">      55 </span>                :    *  output sequence can be written.
<span class="lineNum">      56 </span>                :   */
<span class="lineNum">      57 </span>                :   template&lt;typename _CharT, typename _Traits, typename _Alloc&gt;
<span class="lineNum">      58 </span>                :     class basic_stringbuf : public basic_streambuf&lt;_CharT, _Traits&gt;
<span class="lineNum">      59 </span>                :     {
<span class="lineNum">      60 </span>                :     public:
<span class="lineNum">      61 </span>                :       // Types:
<span class="lineNum">      62 </span>                :       typedef _CharT                                    char_type;
<span class="lineNum">      63 </span>                :       typedef _Traits                                   traits_type;
<span class="lineNum">      64 </span>                :       // _GLIBCXX_RESOLVE_LIB_DEFECTS
<span class="lineNum">      65 </span>                :       // 251. basic_stringbuf missing allocator_type
<span class="lineNum">      66 </span>                :       typedef _Alloc                                    allocator_type;
<span class="lineNum">      67 </span>                :       typedef typename traits_type::int_type            int_type;
<span class="lineNum">      68 </span>                :       typedef typename traits_type::pos_type            pos_type;
<span class="lineNum">      69 </span>                :       typedef typename traits_type::off_type            off_type;
<span class="lineNum">      70 </span>                : 
<span class="lineNum">      71 </span>                :       typedef basic_streambuf&lt;char_type, traits_type&gt;     __streambuf_type;
<span class="lineNum">      72 </span>                :       typedef basic_string&lt;char_type, _Traits, _Alloc&gt;    __string_type;
<span class="lineNum">      73 </span>                :       typedef typename __string_type::size_type         __size_type;
<span class="lineNum">      74 </span>                : 
<span class="lineNum">      75 </span>                :     protected:
<span class="lineNum">      76 </span>                :       /// Place to stash in || out || in | out settings for current stringbuf.
<span class="lineNum">      77 </span>                :       ios_base::openmode        _M_mode;
<span class="lineNum">      78 </span>                : 
<span class="lineNum">      79 </span>                :       // Data Members:
<span class="lineNum">      80 </span>                :       __string_type             _M_string;
<span class="lineNum">      81 </span>                : 
<span class="lineNum">      82 </span>                :     public:
<span class="lineNum">      83 </span>                :       // Constructors:
<span class="lineNum">      84 </span>                :       /**
<span class="lineNum">      85 </span>                :        *  @brief  Starts with an empty string buffer.
<span class="lineNum">      86 </span>                :        *  @param  mode  Whether the buffer can read, or write, or both.
<span class="lineNum">      87 </span>                :        *
<span class="lineNum">      88 </span>                :        *  The default constructor initializes the parent class using its
<span class="lineNum">      89 </span>                :        *  own default ctor.
<span class="lineNum">      90 </span>                :       */
<span class="lineNum">      91 </span>                :       explicit
<span class="lineNum">      92 </span><span class="lineNoCov">              0 :       basic_stringbuf(ios_base::openmode __mode = ios_base::in | ios_base::out)</span>
<span class="lineNum">      93 </span><span class="lineNoCov">              0 :       : __streambuf_type(), _M_mode(__mode), _M_string()</span>
<span class="lineNum">      94 </span><span class="lineNoCov">              0 :       { }</span>
<span class="lineNum">      95 </span>                : 
<span class="lineNum">      96 </span>                :       /**
<span class="lineNum">      97 </span>                :        *  @brief  Starts with an existing string buffer.
<span class="lineNum">      98 </span>                :        *  @param  str  A string to copy as a starting buffer.
<span class="lineNum">      99 </span>                :        *  @param  mode  Whether the buffer can read, or write, or both.
<span class="lineNum">     100 </span>                :        *
<span class="lineNum">     101 </span>                :        *  This constructor initializes the parent class using its
<span class="lineNum">     102 </span>                :        *  own default ctor.
<span class="lineNum">     103 </span>                :       */
<span class="lineNum">     104 </span>                :       explicit
<span class="lineNum">     105 </span>                :       basic_stringbuf(const __string_type&amp; __str,
<span class="lineNum">     106 </span>                :                       ios_base::openmode __mode = ios_base::in | ios_base::out)
<span class="lineNum">     107 </span>                :       : __streambuf_type(), _M_mode(), _M_string(__str.data(), __str.size())
<span class="lineNum">     108 </span>                :       { _M_stringbuf_init(__mode); }
<span class="lineNum">     109 </span>                : 
<span class="lineNum">     110 </span>                :       // Get and set:
<span class="lineNum">     111 </span>                :       /**
<span class="lineNum">     112 </span>                :        *  @brief  Copying out the string buffer.
<span class="lineNum">     113 </span>                :        *  @return  A copy of one of the underlying sequences.
<span class="lineNum">     114 </span>                :        *
<span class="lineNum">     115 </span>                :        *  &quot;If the buffer is only created in input mode, the underlying
<span class="lineNum">     116 </span>                :        *  character sequence is equal to the input sequence; otherwise, it
<span class="lineNum">     117 </span>                :        *  is equal to the output sequence.&quot; [27.7.1.2]/1
<span class="lineNum">     118 </span>                :       */
<span class="lineNum">     119 </span>                :       __string_type
<span class="lineNum">     120 </span><span class="lineNoCov">              0 :       str() const</span>
<span class="lineNum">     121 </span>                :       {
<span class="lineNum">     122 </span><span class="lineNoCov">              0 :         __string_type __ret;</span>
<span class="lineNum">     123 </span><span class="lineNoCov">              0 :         if (this-&gt;pptr())</span>
<span class="lineNum">     124 </span>                :           {
<span class="lineNum">     125 </span>                :             // The current egptr() may not be the actual string end.
<span class="lineNum">     126 </span><span class="lineNoCov">              0 :             if (this-&gt;pptr() &gt; this-&gt;egptr())</span>
<span class="lineNum">     127 </span><span class="lineNoCov">              0 :               __ret = __string_type(this-&gt;pbase(), this-&gt;pptr());</span>
<span class="lineNum">     128 </span>                :             else
<span class="lineNum">     129 </span><span class="lineNoCov">              0 :               __ret = __string_type(this-&gt;pbase(), this-&gt;egptr());</span>
<span class="lineNum">     130 </span>                :           }
<span class="lineNum">     131 </span>                :         else
<span class="lineNum">     132 </span><span class="lineNoCov">              0 :           __ret = _M_string;</span>
<span class="lineNum">     133 </span><span class="lineNoCov">              0 :         return __ret;</span>
<span class="lineNum">     134 </span>                :       }
<span class="lineNum">     135 </span>                : 
<span class="lineNum">     136 </span>                :       /**
<span class="lineNum">     137 </span>                :        *  @brief  Setting a new buffer.
<span class="lineNum">     138 </span>                :        *  @param  s  The string to use as a new sequence.
<span class="lineNum">     139 </span>                :        *
<span class="lineNum">     140 </span>                :        *  Deallocates any previous stored sequence, then copies @a s to
<span class="lineNum">     141 </span>                :        *  use as a new one.
<span class="lineNum">     142 </span>                :       */
<span class="lineNum">     143 </span>                :       void
<span class="lineNum">     144 </span><span class="lineNoCov">              0 :       str(const __string_type&amp; __s)</span>
<span class="lineNum">     145 </span>                :       {
<span class="lineNum">     146 </span>                :         // Cannot use _M_string = __s, since v3 strings are COW.
<span class="lineNum">     147 </span><span class="lineNoCov">              0 :         _M_string.assign(__s.data(), __s.size());</span>
<span class="lineNum">     148 </span><span class="lineNoCov">              0 :         _M_stringbuf_init(_M_mode);</span>
<span class="lineNum">     149 </span><span class="lineNoCov">              0 :       }</span>
<span class="lineNum">     150 </span>                : 
<span class="lineNum">     151 </span>                :     protected:
<span class="lineNum">     152 </span>                :       // Common initialization code goes here.
<span class="lineNum">     153 </span>                :       void
<span class="lineNum">     154 </span><span class="lineNoCov">              0 :       _M_stringbuf_init(ios_base::openmode __mode)</span>
<span class="lineNum">     155 </span>                :       {
<span class="lineNum">     156 </span><span class="lineNoCov">              0 :         _M_mode = __mode;</span>
<span class="lineNum">     157 </span><span class="lineNoCov">              0 :         __size_type __len = 0;</span>
<span class="lineNum">     158 </span><span class="lineNoCov">              0 :         if (_M_mode &amp; (ios_base::ate | ios_base::app))</span>
<span class="lineNum">     159 </span><span class="lineNoCov">              0 :           __len = _M_string.size();</span>
<span class="lineNum">     160 </span><span class="lineNoCov">              0 :         _M_sync(const_cast&lt;char_type*&gt;(_M_string.data()), 0, __len);</span>
<span class="lineNum">     161 </span><span class="lineNoCov">              0 :       }</span>
<span class="lineNum">     162 </span>                : 
<span class="lineNum">     163 </span>                :       virtual streamsize
<span class="lineNum">     164 </span>                :       showmanyc()
<span class="lineNum">     165 </span>                :       { 
<span class="lineNum">     166 </span>                :         streamsize __ret = -1;
<span class="lineNum">     167 </span>                :         if (_M_mode &amp; ios_base::in)
<span class="lineNum">     168 </span>                :           {
<span class="lineNum">     169 </span>                :             _M_update_egptr();
<span class="lineNum">     170 </span>                :             __ret = this-&gt;egptr() - this-&gt;gptr();
<span class="lineNum">     171 </span>                :           }
<span class="lineNum">     172 </span>                :         return __ret;
<span class="lineNum">     173 </span>                :       }
<span class="lineNum">     174 </span>                : 
<span class="lineNum">     175 </span>                :       virtual int_type
<span class="lineNum">     176 </span>                :       underflow();
<span class="lineNum">     177 </span>                : 
<span class="lineNum">     178 </span>                :       virtual int_type
<span class="lineNum">     179 </span>                :       pbackfail(int_type __c = traits_type::eof());
<span class="lineNum">     180 </span>                : 
<span class="lineNum">     181 </span>                :       virtual int_type
<span class="lineNum">     182 </span>                :       overflow(int_type __c = traits_type::eof());
<span class="lineNum">     183 </span>                : 
<span class="lineNum">     184 </span>                :       /**
<span class="lineNum">     185 </span>                :        *  @brief  Manipulates the buffer.
<span class="lineNum">     186 </span>                :        *  @param  s  Pointer to a buffer area.
<span class="lineNum">     187 </span>                :        *  @param  n  Size of @a s.
<span class="lineNum">     188 </span>                :        *  @return  @c this
<span class="lineNum">     189 </span>                :        *
<span class="lineNum">     190 </span>                :        *  If no buffer has already been created, and both @a s and @a n are
<span class="lineNum">     191 </span>                :        *  non-zero, then @c s is used as a buffer; see
<span class="lineNum">     192 </span>                :        *  http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch25s02.html
<span class="lineNum">     193 </span>                :        *  for more.
<span class="lineNum">     194 </span>                :       */
<span class="lineNum">     195 </span>                :       virtual __streambuf_type*
<span class="lineNum">     196 </span>                :       setbuf(char_type* __s, streamsize __n)
<span class="lineNum">     197 </span>                :       {
<span class="lineNum">     198 </span>                :         if (__s &amp;&amp; __n &gt;= 0)
<span class="lineNum">     199 </span>                :           {
<span class="lineNum">     200 </span>                :             // This is implementation-defined behavior, and assumes
<span class="lineNum">     201 </span>                :             // that an external char_type array of length __n exists
<span class="lineNum">     202 </span>                :             // and has been pre-allocated. If this is not the case,
<span class="lineNum">     203 </span>                :             // things will quickly blow up.
<span class="lineNum">     204 </span>                :             
<span class="lineNum">     205 </span>                :             // Step 1: Destroy the current internal array.
<span class="lineNum">     206 </span>                :             _M_string.clear();
<span class="lineNum">     207 </span>                :             
<span class="lineNum">     208 </span>                :             // Step 2: Use the external array.
<span class="lineNum">     209 </span>                :             _M_sync(__s, __n, 0);
<span class="lineNum">     210 </span>                :           }
<span class="lineNum">     211 </span>                :         return this;
<span class="lineNum">     212 </span>                :       }
<span class="lineNum">     213 </span>                : 
<span class="lineNum">     214 </span>                :       virtual pos_type
<span class="lineNum">     215 </span>                :       seekoff(off_type __off, ios_base::seekdir __way,
<span class="lineNum">     216 </span>                :               ios_base::openmode __mode = ios_base::in | ios_base::out);
<span class="lineNum">     217 </span>                : 
<span class="lineNum">     218 </span>                :       virtual pos_type
<span class="lineNum">     219 </span>                :       seekpos(pos_type __sp,
<span class="lineNum">     220 </span>                :               ios_base::openmode __mode = ios_base::in | ios_base::out);
<span class="lineNum">     221 </span>                : 
<span class="lineNum">     222 </span>                :       // Internal function for correctly updating the internal buffer
<span class="lineNum">     223 </span>                :       // for a particular _M_string, due to initialization or re-sizing
<span class="lineNum">     224 </span>                :       // of an existing _M_string.
<span class="lineNum">     225 </span>                :       void
<span class="lineNum">     226 </span>                :       _M_sync(char_type* __base, __size_type __i, __size_type __o);
<span class="lineNum">     227 </span>                : 
<span class="lineNum">     228 </span>                :       // Internal function for correctly updating egptr() to the actual
<span class="lineNum">     229 </span>                :       // string end.
<span class="lineNum">     230 </span>                :       void
<span class="lineNum">     231 </span>                :       _M_update_egptr()
<span class="lineNum">     232 </span>                :       {
<span class="lineNum">     233 </span>                :         const bool __testin = _M_mode &amp; ios_base::in;
<span class="lineNum">     234 </span>                :         if (this-&gt;pptr() &amp;&amp; this-&gt;pptr() &gt; this-&gt;egptr())
<span class="lineNum">     235 </span>                :           {
<span class="lineNum">     236 </span>                :             if (__testin)
<span class="lineNum">     237 </span>                :               this-&gt;setg(this-&gt;eback(), this-&gt;gptr(), this-&gt;pptr());
<span class="lineNum">     238 </span>                :             else
<span class="lineNum">     239 </span>                :               this-&gt;setg(this-&gt;pptr(), this-&gt;pptr(), this-&gt;pptr());
<span class="lineNum">     240 </span>                :           }
<span class="lineNum">     241 </span>                :       }
<span class="lineNum">     242 </span>                :     };
<span class="lineNum">     243 </span>                : 
<span class="lineNum">     244 </span>                : 
<span class="lineNum">     245 </span>                :   // [27.7.2] Template class basic_istringstream
<span class="lineNum">     246 </span>                :   /**
<span class="lineNum">     247 </span>                :    *  @brief  Controlling input for std::string.
<span class="lineNum">     248 </span>                :    *  @ingroup io
<span class="lineNum">     249 </span>                :    *
<span class="lineNum">     250 </span>                :    *  This class supports reading from objects of type std::basic_string,
<span class="lineNum">     251 </span>                :    *  using the inherited functions from std::basic_istream.  To control
<span class="lineNum">     252 </span>                :    *  the associated sequence, an instance of std::basic_stringbuf is used,
<span class="lineNum">     253 </span>                :    *  which this page refers to as @c sb.
<span class="lineNum">     254 </span>                :   */
<span class="lineNum">     255 </span>                :   template&lt;typename _CharT, typename _Traits, typename _Alloc&gt;
<span class="lineNum">     256 </span>                :     class basic_istringstream : public basic_istream&lt;_CharT, _Traits&gt;
<span class="lineNum">     257 </span>                :     {
<span class="lineNum">     258 </span>                :     public:
<span class="lineNum">     259 </span>                :       // Types:
<span class="lineNum">     260 </span>                :       typedef _CharT                                    char_type;
<span class="lineNum">     261 </span>                :       typedef _Traits                                   traits_type;
<span class="lineNum">     262 </span>                :       // _GLIBCXX_RESOLVE_LIB_DEFECTS
<span class="lineNum">     263 </span>                :       // 251. basic_stringbuf missing allocator_type
<span class="lineNum">     264 </span>                :       typedef _Alloc                                    allocator_type;
<span class="lineNum">     265 </span>                :       typedef typename traits_type::int_type            int_type;
<span class="lineNum">     266 </span>                :       typedef typename traits_type::pos_type            pos_type;
<span class="lineNum">     267 </span>                :       typedef typename traits_type::off_type            off_type;
<span class="lineNum">     268 </span>                : 
<span class="lineNum">     269 </span>                :       // Non-standard types:
<span class="lineNum">     270 </span>                :       typedef basic_string&lt;_CharT, _Traits, _Alloc&gt;       __string_type;
<span class="lineNum">     271 </span>                :       typedef basic_stringbuf&lt;_CharT, _Traits, _Alloc&gt;    __stringbuf_type;
<span class="lineNum">     272 </span>                :       typedef basic_istream&lt;char_type, traits_type&gt;       __istream_type;
<span class="lineNum">     273 </span>                : 
<span class="lineNum">     274 </span>                :     private:
<span class="lineNum">     275 </span>                :       __stringbuf_type  _M_stringbuf;
<span class="lineNum">     276 </span>                : 
<span class="lineNum">     277 </span>                :     public:
<span class="lineNum">     278 </span>                :       // Constructors:
<span class="lineNum">     279 </span>                :       /**
<span class="lineNum">     280 </span>                :        *  @brief  Default constructor starts with an empty string buffer.
<span class="lineNum">     281 </span>                :        *  @param  mode  Whether the buffer can read, or write, or both.
<span class="lineNum">     282 </span>                :        *
<span class="lineNum">     283 </span>                :        *  @c ios_base::in is automatically included in @a mode.
<span class="lineNum">     284 </span>                :        *
<span class="lineNum">     285 </span>                :        *  Initializes @c sb using @c mode|in, and passes @c &amp;sb to the base
<span class="lineNum">     286 </span>                :        *  class initializer.  Does not allocate any buffer.
<span class="lineNum">     287 </span>                :        *
<span class="lineNum">     288 </span>                :        *  That's a lie.  We initialize the base class with NULL, because the
<span class="lineNum">     289 </span>                :        *  string class does its own memory management.
<span class="lineNum">     290 </span>                :       */
<span class="lineNum">     291 </span>                :       explicit
<span class="lineNum">     292 </span>                :       basic_istringstream(ios_base::openmode __mode = ios_base::in)
<span class="lineNum">     293 </span>                :       : __istream_type(), _M_stringbuf(__mode | ios_base::in)
<span class="lineNum">     294 </span>                :       { this-&gt;init(&amp;_M_stringbuf); }
<span class="lineNum">     295 </span>                : 
<span class="lineNum">     296 </span>                :       /**
<span class="lineNum">     297 </span>                :        *  @brief  Starts with an existing string buffer.
<span class="lineNum">     298 </span>                :        *  @param  str  A string to copy as a starting buffer.
<span class="lineNum">     299 </span>                :        *  @param  mode  Whether the buffer can read, or write, or both.
<span class="lineNum">     300 </span>                :        *
<span class="lineNum">     301 </span>                :        *  @c ios_base::in is automatically included in @a mode.
<span class="lineNum">     302 </span>                :        *
<span class="lineNum">     303 </span>                :        *  Initializes @c sb using @a str and @c mode|in, and passes @c &amp;sb
<span class="lineNum">     304 </span>                :        *  to the base class initializer.
<span class="lineNum">     305 </span>                :        *
<span class="lineNum">     306 </span>                :        *  That's a lie.  We initialize the base class with NULL, because the
<span class="lineNum">     307 </span>                :        *  string class does its own memory management.
<span class="lineNum">     308 </span>                :       */
<span class="lineNum">     309 </span>                :       explicit
<span class="lineNum">     310 </span>                :       basic_istringstream(const __string_type&amp; __str,
<span class="lineNum">     311 </span>                :                           ios_base::openmode __mode = ios_base::in)
<span class="lineNum">     312 </span>                :       : __istream_type(), _M_stringbuf(__str, __mode | ios_base::in)
<span class="lineNum">     313 </span>                :       { this-&gt;init(&amp;_M_stringbuf); }
<span class="lineNum">     314 </span>                : 
<span class="lineNum">     315 </span>                :       /**
<span class="lineNum">     316 </span>                :        *  @brief  The destructor does nothing.
<span class="lineNum">     317 </span>                :        *
<span class="lineNum">     318 </span>                :        *  The buffer is deallocated by the stringbuf object, not the
<span class="lineNum">     319 </span>                :        *  formatting stream.
<span class="lineNum">     320 </span>                :       */
<span class="lineNum">     321 </span>                :       ~basic_istringstream()
<span class="lineNum">     322 </span>                :       { }
<span class="lineNum">     323 </span>                : 
<span class="lineNum">     324 </span>                :       // Members:
<span class="lineNum">     325 </span>                :       /**
<span class="lineNum">     326 </span>                :        *  @brief  Accessing the underlying buffer.
<span class="lineNum">     327 </span>                :        *  @return  The current basic_stringbuf buffer.
<span class="lineNum">     328 </span>                :        *
<span class="lineNum">     329 </span>                :        *  This hides both signatures of std::basic_ios::rdbuf().
<span class="lineNum">     330 </span>                :       */
<span class="lineNum">     331 </span>                :       __stringbuf_type*
<span class="lineNum">     332 </span>                :       rdbuf() const
<span class="lineNum">     333 </span>                :       { return const_cast&lt;__stringbuf_type*&gt;(&amp;_M_stringbuf); }
<span class="lineNum">     334 </span>                : 
<span class="lineNum">     335 </span>                :       /**
<span class="lineNum">     336 </span>                :        *  @brief  Copying out the string buffer.
<span class="lineNum">     337 </span>                :        *  @return  @c rdbuf()-&gt;str()
<span class="lineNum">     338 </span>                :       */
<span class="lineNum">     339 </span>                :       __string_type
<span class="lineNum">     340 </span>                :       str() const
<span class="lineNum">     341 </span>                :       { return _M_stringbuf.str(); }
<span class="lineNum">     342 </span>                : 
<span class="lineNum">     343 </span>                :       /**
<span class="lineNum">     344 </span>                :        *  @brief  Setting a new buffer.
<span class="lineNum">     345 </span>                :        *  @param  s  The string to use as a new sequence.
<span class="lineNum">     346 </span>                :        *
<span class="lineNum">     347 </span>                :        *  Calls @c rdbuf()-&gt;str(s).
<span class="lineNum">     348 </span>                :       */
<span class="lineNum">     349 </span>                :       void
<span class="lineNum">     350 </span>                :       str(const __string_type&amp; __s)
<span class="lineNum">     351 </span>                :       { _M_stringbuf.str(__s); }
<span class="lineNum">     352 </span>                :     };
<span class="lineNum">     353 </span>                : 
<span class="lineNum">     354 </span>                : 
<span class="lineNum">     355 </span>                :   // [27.7.3] Template class basic_ostringstream
<span class="lineNum">     356 </span>                :   /**
<span class="lineNum">     357 </span>                :    *  @brief  Controlling output for std::string.
<span class="lineNum">     358 </span>                :    *  @ingroup io
<span class="lineNum">     359 </span>                :    *
<span class="lineNum">     360 </span>                :    *  This class supports writing to objects of type std::basic_string,
<span class="lineNum">     361 </span>                :    *  using the inherited functions from std::basic_ostream.  To control
<span class="lineNum">     362 </span>                :    *  the associated sequence, an instance of std::basic_stringbuf is used,
<span class="lineNum">     363 </span>                :    *  which this page refers to as @c sb.
<span class="lineNum">     364 </span>                :   */
<span class="lineNum">     365 </span>                :   template &lt;typename _CharT, typename _Traits, typename _Alloc&gt;
<span class="lineNum">     366 </span>                :     class basic_ostringstream : public basic_ostream&lt;_CharT, _Traits&gt;
<span class="lineNum">     367 </span>                :     {
<span class="lineNum">     368 </span>                :     public:
<span class="lineNum">     369 </span>                :       // Types:
<span class="lineNum">     370 </span>                :       typedef _CharT                                    char_type;
<span class="lineNum">     371 </span>                :       typedef _Traits                                   traits_type;
<span class="lineNum">     372 </span>                :       // _GLIBCXX_RESOLVE_LIB_DEFECTS
<span class="lineNum">     373 </span>                :       // 251. basic_stringbuf missing allocator_type
<span class="lineNum">     374 </span>                :       typedef _Alloc                                    allocator_type;
<span class="lineNum">     375 </span>                :       typedef typename traits_type::int_type            int_type;
<span class="lineNum">     376 </span>                :       typedef typename traits_type::pos_type            pos_type;
<span class="lineNum">     377 </span>                :       typedef typename traits_type::off_type            off_type;
<span class="lineNum">     378 </span>                : 
<span class="lineNum">     379 </span>                :       // Non-standard types:
<span class="lineNum">     380 </span>                :       typedef basic_string&lt;_CharT, _Traits, _Alloc&gt;       __string_type;
<span class="lineNum">     381 </span>                :       typedef basic_stringbuf&lt;_CharT, _Traits, _Alloc&gt;    __stringbuf_type;
<span class="lineNum">     382 </span>                :       typedef basic_ostream&lt;char_type, traits_type&gt;       __ostream_type;
<span class="lineNum">     383 </span>                : 
<span class="lineNum">     384 </span>                :     private:
<span class="lineNum">     385 </span>                :       __stringbuf_type  _M_stringbuf;
<span class="lineNum">     386 </span>                : 
<span class="lineNum">     387 </span>                :     public:
<span class="lineNum">     388 </span>                :       // Constructors/destructor:
<span class="lineNum">     389 </span>                :       /**
<span class="lineNum">     390 </span>                :        *  @brief  Default constructor starts with an empty string buffer.
<span class="lineNum">     391 </span>                :        *  @param  mode  Whether the buffer can read, or write, or both.
<span class="lineNum">     392 </span>                :        *
<span class="lineNum">     393 </span>                :        *  @c ios_base::out is automatically included in @a mode.
<span class="lineNum">     394 </span>                :        *
<span class="lineNum">     395 </span>                :        *  Initializes @c sb using @c mode|out, and passes @c &amp;sb to the base
<span class="lineNum">     396 </span>                :        *  class initializer.  Does not allocate any buffer.
<span class="lineNum">     397 </span>                :        *
<span class="lineNum">     398 </span>                :        *  That's a lie.  We initialize the base class with NULL, because the
<span class="lineNum">     399 </span>                :        *  string class does its own memory management.
<span class="lineNum">     400 </span>                :       */
<span class="lineNum">     401 </span>                :       explicit
<span class="lineNum">     402 </span><span class="lineNoCov">              0 :       basic_ostringstream(ios_base::openmode __mode = ios_base::out)</span>
<span class="lineNum">     403 </span><span class="lineNoCov">              0 :       : __ostream_type(), _M_stringbuf(__mode | ios_base::out)</span>
<span class="lineNum">     404 </span><span class="lineNoCov">              0 :       { this-&gt;init(&amp;_M_stringbuf); }</span>
<span class="lineNum">     405 </span>                : 
<span class="lineNum">     406 </span>                :       /**
<span class="lineNum">     407 </span>                :        *  @brief  Starts with an existing string buffer.
<span class="lineNum">     408 </span>                :        *  @param  str  A string to copy as a starting buffer.
<span class="lineNum">     409 </span>                :        *  @param  mode  Whether the buffer can read, or write, or both.
<span class="lineNum">     410 </span>                :        *
<span class="lineNum">     411 </span>                :        *  @c ios_base::out is automatically included in @a mode.
<span class="lineNum">     412 </span>                :        *
<span class="lineNum">     413 </span>                :        *  Initializes @c sb using @a str and @c mode|out, and passes @c &amp;sb
<span class="lineNum">     414 </span>                :        *  to the base class initializer.
<span class="lineNum">     415 </span>                :        *
<span class="lineNum">     416 </span>                :        *  That's a lie.  We initialize the base class with NULL, because the
<span class="lineNum">     417 </span>                :        *  string class does its own memory management.
<span class="lineNum">     418 </span>                :       */
<span class="lineNum">     419 </span>                :       explicit
<span class="lineNum">     420 </span>                :       basic_ostringstream(const __string_type&amp; __str,
<span class="lineNum">     421 </span>                :                           ios_base::openmode __mode = ios_base::out)
<span class="lineNum">     422 </span>                :       : __ostream_type(), _M_stringbuf(__str, __mode | ios_base::out)
<span class="lineNum">     423 </span>                :       { this-&gt;init(&amp;_M_stringbuf); }
<span class="lineNum">     424 </span>                : 
<span class="lineNum">     425 </span>                :       /**
<span class="lineNum">     426 </span>                :        *  @brief  The destructor does nothing.
<span class="lineNum">     427 </span>                :        *
<span class="lineNum">     428 </span>                :        *  The buffer is deallocated by the stringbuf object, not the
<span class="lineNum">     429 </span>                :        *  formatting stream.
<span class="lineNum">     430 </span>                :       */
<span class="lineNum">     431 </span><span class="lineNoCov">              0 :       ~basic_ostringstream()</span>
<span class="lineNum">     432 </span><span class="lineNoCov">              0 :       { }</span>
<span class="lineNum">     433 </span>                : 
<span class="lineNum">     434 </span>                :       // Members:
<span class="lineNum">     435 </span>                :       /**
<span class="lineNum">     436 </span>                :        *  @brief  Accessing the underlying buffer.
<span class="lineNum">     437 </span>                :        *  @return  The current basic_stringbuf buffer.
<span class="lineNum">     438 </span>                :        *
<span class="lineNum">     439 </span>                :        *  This hides both signatures of std::basic_ios::rdbuf().
<span class="lineNum">     440 </span>                :       */
<span class="lineNum">     441 </span>                :       __stringbuf_type*
<span class="lineNum">     442 </span>                :       rdbuf() const
<span class="lineNum">     443 </span>                :       { return const_cast&lt;__stringbuf_type*&gt;(&amp;_M_stringbuf); }
<span class="lineNum">     444 </span>                : 
<span class="lineNum">     445 </span>                :       /**
<span class="lineNum">     446 </span>                :        *  @brief  Copying out the string buffer.
<span class="lineNum">     447 </span>                :        *  @return  @c rdbuf()-&gt;str()
<span class="lineNum">     448 </span>                :       */
<span class="lineNum">     449 </span>                :       __string_type
<span class="lineNum">     450 </span><span class="lineNoCov">              0 :       str() const</span>
<span class="lineNum">     451 </span><span class="lineNoCov">              0 :       { return _M_stringbuf.str(); }</span>
<span class="lineNum">     452 </span>                : 
<span class="lineNum">     453 </span>                :       /**
<span class="lineNum">     454 </span>                :        *  @brief  Setting a new buffer.
<span class="lineNum">     455 </span>                :        *  @param  s  The string to use as a new sequence.
<span class="lineNum">     456 </span>                :        *
<span class="lineNum">     457 </span>                :        *  Calls @c rdbuf()-&gt;str(s).
<span class="lineNum">     458 </span>                :       */
<span class="lineNum">     459 </span>                :       void
<span class="lineNum">     460 </span><span class="lineNoCov">              0 :       str(const __string_type&amp; __s)</span>
<span class="lineNum">     461 </span><span class="lineNoCov">              0 :       { _M_stringbuf.str(__s); }</span>
<span class="lineNum">     462 </span>                :     };
<span class="lineNum">     463 </span>                : 
<span class="lineNum">     464 </span>                : 
<span class="lineNum">     465 </span>                :   // [27.7.4] Template class basic_stringstream
<span class="lineNum">     466 </span>                :   /**
<span class="lineNum">     467 </span>                :    *  @brief  Controlling input and output for std::string.
<span class="lineNum">     468 </span>                :    *  @ingroup io
<span class="lineNum">     469 </span>                :    *
<span class="lineNum">     470 </span>                :    *  This class supports reading from and writing to objects of type
<span class="lineNum">     471 </span>                :    *  std::basic_string, using the inherited functions from
<span class="lineNum">     472 </span>                :    *  std::basic_iostream.  To control the associated sequence, an instance
<span class="lineNum">     473 </span>                :    *  of std::basic_stringbuf is used, which this page refers to as @c sb.
<span class="lineNum">     474 </span>                :   */
<span class="lineNum">     475 </span>                :   template &lt;typename _CharT, typename _Traits, typename _Alloc&gt;
<span class="lineNum">     476 </span>                :     class basic_stringstream : public basic_iostream&lt;_CharT, _Traits&gt;
<span class="lineNum">     477 </span>                :     {
<span class="lineNum">     478 </span>                :     public:
<span class="lineNum">     479 </span>                :       // Types:
<span class="lineNum">     480 </span>                :       typedef _CharT                                    char_type;
<span class="lineNum">     481 </span>                :       typedef _Traits                                   traits_type;
<span class="lineNum">     482 </span>                :       // _GLIBCXX_RESOLVE_LIB_DEFECTS
<span class="lineNum">     483 </span>                :       // 251. basic_stringbuf missing allocator_type
<span class="lineNum">     484 </span>                :       typedef _Alloc                                    allocator_type;
<span class="lineNum">     485 </span>                :       typedef typename traits_type::int_type            int_type;
<span class="lineNum">     486 </span>                :       typedef typename traits_type::pos_type            pos_type;
<span class="lineNum">     487 </span>                :       typedef typename traits_type::off_type            off_type;
<span class="lineNum">     488 </span>                : 
<span class="lineNum">     489 </span>                :       // Non-standard Types:
<span class="lineNum">     490 </span>                :       typedef basic_string&lt;_CharT, _Traits, _Alloc&gt;       __string_type;
<span class="lineNum">     491 </span>                :       typedef basic_stringbuf&lt;_CharT, _Traits, _Alloc&gt;    __stringbuf_type;
<span class="lineNum">     492 </span>                :       typedef basic_iostream&lt;char_type, traits_type&gt;      __iostream_type;
<span class="lineNum">     493 </span>                : 
<span class="lineNum">     494 </span>                :     private:
<span class="lineNum">     495 </span>                :       __stringbuf_type  _M_stringbuf;
<span class="lineNum">     496 </span>                : 
<span class="lineNum">     497 </span>                :     public:
<span class="lineNum">     498 </span>                :       // Constructors/destructors
<span class="lineNum">     499 </span>                :       /**
<span class="lineNum">     500 </span>                :        *  @brief  Default constructor starts with an empty string buffer.
<span class="lineNum">     501 </span>                :        *  @param  mode  Whether the buffer can read, or write, or both.
<span class="lineNum">     502 </span>                :        *
<span class="lineNum">     503 </span>                :        *  Initializes @c sb using @c mode, and passes @c &amp;sb to the base
<span class="lineNum">     504 </span>                :        *  class initializer.  Does not allocate any buffer.
<span class="lineNum">     505 </span>                :        *
<span class="lineNum">     506 </span>                :        *  That's a lie.  We initialize the base class with NULL, because the
<span class="lineNum">     507 </span>                :        *  string class does its own memory management.
<span class="lineNum">     508 </span>                :       */
<span class="lineNum">     509 </span>                :       explicit
<span class="lineNum">     510 </span><span class="lineNoCov">              0 :       basic_stringstream(ios_base::openmode __m = ios_base::out | ios_base::in)</span>
<span class="lineNum">     511 </span><span class="lineNoCov">              0 :       : __iostream_type(), _M_stringbuf(__m)</span>
<span class="lineNum">     512 </span><span class="lineNoCov">              0 :       { this-&gt;init(&amp;_M_stringbuf); }</span>
<span class="lineNum">     513 </span>                : 
<span class="lineNum">     514 </span>                :       /**
<span class="lineNum">     515 </span>                :        *  @brief  Starts with an existing string buffer.
<span class="lineNum">     516 </span>                :        *  @param  str  A string to copy as a starting buffer.
<span class="lineNum">     517 </span>                :        *  @param  mode  Whether the buffer can read, or write, or both.
<span class="lineNum">     518 </span>                :        *
<span class="lineNum">     519 </span>                :        *  Initializes @c sb using @a str and @c mode, and passes @c &amp;sb
<span class="lineNum">     520 </span>                :        *  to the base class initializer.
<span class="lineNum">     521 </span>                :        *
<span class="lineNum">     522 </span>                :        *  That's a lie.  We initialize the base class with NULL, because the
<span class="lineNum">     523 </span>                :        *  string class does its own memory management.
<span class="lineNum">     524 </span>                :       */
<span class="lineNum">     525 </span>                :       explicit
<span class="lineNum">     526 </span>                :       basic_stringstream(const __string_type&amp; __str,
<span class="lineNum">     527 </span>                :                          ios_base::openmode __m = ios_base::out | ios_base::in)
<span class="lineNum">     528 </span>                :       : __iostream_type(), _M_stringbuf(__str, __m)
<span class="lineNum">     529 </span>                :       { this-&gt;init(&amp;_M_stringbuf); }
<span class="lineNum">     530 </span>                : 
<span class="lineNum">     531 </span>                :       /**
<span class="lineNum">     532 </span>                :        *  @brief  The destructor does nothing.
<span class="lineNum">     533 </span>                :        *
<span class="lineNum">     534 </span>                :        *  The buffer is deallocated by the stringbuf object, not the
<span class="lineNum">     535 </span>                :        *  formatting stream.
<span class="lineNum">     536 </span>                :       */
<span class="lineNum">     537 </span><span class="lineNoCov">              0 :       ~basic_stringstream()</span>
<span class="lineNum">     538 </span><span class="lineNoCov">              0 :       { }</span>
<span class="lineNum">     539 </span>                : 
<span class="lineNum">     540 </span>                :       // Members:
<span class="lineNum">     541 </span>                :       /**
<span class="lineNum">     542 </span>                :        *  @brief  Accessing the underlying buffer.
<span class="lineNum">     543 </span>                :        *  @return  The current basic_stringbuf buffer.
<span class="lineNum">     544 </span>                :        *
<span class="lineNum">     545 </span>                :        *  This hides both signatures of std::basic_ios::rdbuf().
<span class="lineNum">     546 </span>                :       */
<span class="lineNum">     547 </span>                :       __stringbuf_type*
<span class="lineNum">     548 </span>                :       rdbuf() const
<span class="lineNum">     549 </span>                :       { return const_cast&lt;__stringbuf_type*&gt;(&amp;_M_stringbuf); }
<span class="lineNum">     550 </span>                : 
<span class="lineNum">     551 </span>                :       /**
<span class="lineNum">     552 </span>                :        *  @brief  Copying out the string buffer.
<span class="lineNum">     553 </span>                :        *  @return  @c rdbuf()-&gt;str()
<span class="lineNum">     554 </span>                :       */
<span class="lineNum">     555 </span>                :       __string_type
<span class="lineNum">     556 </span>                :       str() const
<span class="lineNum">     557 </span>                :       { return _M_stringbuf.str(); }
<span class="lineNum">     558 </span>                : 
<span class="lineNum">     559 </span>                :       /**
<span class="lineNum">     560 </span>                :        *  @brief  Setting a new buffer.
<span class="lineNum">     561 </span>                :        *  @param  s  The string to use as a new sequence.
<span class="lineNum">     562 </span>                :        *
<span class="lineNum">     563 </span>                :        *  Calls @c rdbuf()-&gt;str(s).
<span class="lineNum">     564 </span>                :       */
<span class="lineNum">     565 </span>                :       void
<span class="lineNum">     566 </span>                :       str(const __string_type&amp; __s)
<span class="lineNum">     567 </span>                :       { _M_stringbuf.str(__s); }
<span class="lineNum">     568 </span>                :     };
<span class="lineNum">     569 </span>                : 
<span class="lineNum">     570 </span>                : _GLIBCXX_END_NAMESPACE
<span class="lineNum">     571 </span>                : 
<span class="lineNum">     572 </span>                : #ifndef _GLIBCXX_EXPORT_TEMPLATE
<span class="lineNum">     573 </span>                : # include &lt;bits/sstream.tcc&gt;
<span class="lineNum">     574 </span>                : #endif
<span class="lineNum">     575 </span>                : 
<span class="lineNum">     576 </span>                : #endif /* _GLIBCXX_SSTREAM */
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
  <tr><td class="ruler"><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>
  <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LTP GCOV extension version 1.6</a></td></tr>
  </table>
  <br>

</body>
</html>
